package lostland.gmud.exv2.data;

import java.util.ArrayList;
import java.util.Arrays;

import lostland.gmud.exv2.GameConstants;
import lostland.gmud.exv2.Gmud;

/**
 * 用模板生成NPC属性。
 * Created by 12548 on 2015/5/11.
 */
public interface NpcModifier {

	/**
	 * 将模板应用于指定NPC。
	 *
	 * @param npc  要应用的NPC
	 * @param rate 比例
	 */
	void applyTo(Npc npc, float rate);

	/**
	 * 清除所有技能。
	 */
	NpcModifier CLEAR_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			Arrays.fill(npc.skills, 0);
			Arrays.fill(npc.skillsckd, -1);
		}
	};

	NpcModifier BASIC_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();
			skills.add(Gmud.findSkill("基本拳脚").id);
			skills.add(Gmud.findSkill("基本内功").id);
			skills.add(Gmud.findSkill("基本轻功").id);
			skills.add(Gmud.findSkill("基本招架").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE);
		}
	};


	NpcModifier XUESHAN_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();

			skills.add(Gmud.findSkill("雪影擒拿手").id);
			skills.add(Gmud.findSkill("入门十三式").id);
			skills.add(Gmud.findSkill("雪山剑法").id);
			skills.add(Gmud.findSkill("基本剑法").id);
			skills.add(Gmud.findSkill("踏雪无痕").id);
			skills.add(Gmud.findSkill("雪山内功").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE).use(i);
		}
	};


	NpcModifier HONGLIAN_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();

			skills.add(Gmud.findSkill("太祖长拳").id);
			skills.add(Gmud.findSkill("乱披风杖法").id);
			skills.add(Gmud.findSkill("基本杖法").id);
			skills.add(Gmud.findSkill("鹤翔身法").id);
			skills.add(Gmud.findSkill("普天同济").id);
			skills.add(Gmud.findSkill("红莲教义").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE).use(i);
		}
	};

	NpcModifier TAIJI_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();

			skills.add(Gmud.findSkill("太极拳").id);
			skills.add(Gmud.findSkill("玄虚刀法").id);
			skills.add(Gmud.findSkill("基本刀法").id);
			skills.add(Gmud.findSkill("太极剑").id);
			skills.add(Gmud.findSkill("基本剑法").id);
			skills.add(Gmud.findSkill("万流归一").id);
			skills.add(Gmud.findSkill("太极神功").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE).use(i);
		}
	};

	NpcModifier BAGUA_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();

			skills.add(Gmud.findSkill("八卦游身掌").id);
			skills.add(Gmud.findSkill("八阵八卦掌").id);
			skills.add(Gmud.findSkill("八卦刀").id);
			skills.add(Gmud.findSkill("基本刀法").id);
			skills.add(Gmud.findSkill("游龙身法").id);
			skills.add(Gmud.findSkill("混元一气功").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE).use(i);
		}
	};


	NpcModifier YINHE_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();

			skills.add(Gmud.findSkill("无法拳").id);
			skills.add(Gmud.findSkill("川枫一刀流").id);
			skills.add(Gmud.findSkill("基本刀法").id);
			skills.add(Gmud.findSkill("无影遁形").id);
			skills.add(Gmud.findSkill("扶桑忍术").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE).use(i);
		}
	};

	NpcModifier HUAJIAN_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();

			skills.add(Gmud.findSkill("一剪梅花手").id);
			skills.add(Gmud.findSkill("柳叶刀法").id);
			skills.add(Gmud.findSkill("基本刀法").id);
			skills.add(Gmud.findSkill("花团鞭法").id);
			skills.add(Gmud.findSkill("基本鞭法").id);
			skills.add(Gmud.findSkill("飞蝶身法").id);
			skills.add(Gmud.findSkill("三花聚顶").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE).use(i);
		}
	};

	NpcModifier GAIBANG_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();

			skills.add(Gmud.findSkill("乞者快拳").id);
			skills.add(Gmud.findSkill("降龙十八掌").id);
			skills.add(Gmud.findSkill("打狗棒法").id);
			skills.add(Gmud.findSkill("基本棍法").id);
			skills.add(Gmud.findSkill("逍遥游").id);
			skills.add(Gmud.findSkill("神丐心法").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE).use(i);
		}
	};

	NpcModifier SHAOLIN_SKILLS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			final int SKILL_LEVEL_BASE = (int) (Gmud.mc.getTotalSkillLevel() * 0.25 * rate);

			ArrayList<Integer> skills = new ArrayList<>();

			skills.add(Gmud.findSkill("罗汉拳").id);
			skills.add(Gmud.findSkill("降魔棍法").id);
			skills.add(Gmud.findSkill("一苇渡江").id);
			skills.add(Gmud.findSkill("达摩内功").id);
			skills.add(Gmud.findSkill("金钟罩").id);

			for(int i : skills) npc.learn(i, SKILL_LEVEL_BASE).use(i);
		}
	};

	NpcModifier CLEAR_ITEMS = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.inventory.clear();
			Arrays.fill(npc.equipments, Item.getNullItem());
		}
	};

	NpcModifier WEAPON_QUANJIAO_1 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.unequip(npc.getAttackItem());
		}
	};
	NpcModifier WEAPON_QUANJIAO_2 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("牛皮手套").id);
		}
	};


	NpcModifier WEAPON_DAO_1 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("钢刀").id);
		}
	};
	NpcModifier WEAPON_DAO_2 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("钢刀").id);
		}
	};

	NpcModifier WEAPON_JIAN_1 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("长剑").id);
		}
	};
	NpcModifier WEAPON_JIAN_2 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("长剑").id);
		}
	};

	NpcModifier WEAPON_BIAN_1 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("长鞭").id);
		}
	};
	NpcModifier WEAPON_BIAN_2 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("长鞭").id);
		}
	};

	NpcModifier WEAPON_ZHANG_1 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("钢杖").id);
		}
	};
	NpcModifier WEAPON_ZHANG_2 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("精钢杖").id);
		}
	};

	NpcModifier WEAPON_GUN_1 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("木棍").id);
		}
	};
	NpcModifier WEAPON_GUN_2 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("铁棍").id);
		}
	};

	NpcModifier EQUIPMENTS_1 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("布衣").id);
		}
	};
	NpcModifier EQUIPMENTS_2 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.carryandequip(Gmud.findItem("白罗袍").id);
			npc.carryandequip(Gmud.findItem("草鞋").id);
		}
	};

	NpcModifier ATTR_BASIC = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			npc.strength((int) (20 * rate))
					.agility((int) (20 * rate))
					.intelligence((int) (20 * rate))
					.constitution((int) (20 * rate));
		}
	};

	NpcModifier ATTR_MT = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			ATTR_BASIC.applyTo(npc, rate);
			npc.agi += 2;
			npc.wxg -= 2;
			npc.bon += 8;
		}
	};

	NpcModifier ATTR_ASSASSIN = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			ATTR_BASIC.applyTo(npc, rate);
			npc.str -= 2;
			npc.bon -= 8;
			npc.agi += 4;
			npc.wxg += 16;
		}
	};

	NpcModifier ATTR_FIGHTER = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			ATTR_BASIC.applyTo(npc, rate);
			npc.str += 3;
			npc.bon += 3;
			npc.agi += 2;
			npc.wxg += 2;
		}
	};

	NpcModifier ATTR_BASHER = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			ATTR_BASIC.applyTo(npc, rate);
			npc.str += 5;
			npc.bon += -2;
			npc.agi += -3;
			npc.wxg += 10;
		}
	};

	NpcModifier SKILLANDWEAPON_HONGLIAN_RANDOM = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_SKILLS.applyTo(npc, rate);
			BASIC_SKILLS.applyTo(npc, rate);
			HONGLIAN_SKILLS.applyTo(npc, rate);

			switch(Gmud.rand.nextInt(2)) { //技能
				case 0: //拳脚
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_QUANJIAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_QUANJIAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 1: //杖法
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_ZHANG_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_ZHANG_2.applyTo(npc, rate);
							break;
					}
					break;
			}
		}
	};

	NpcModifier SKILLANDWEAPON_YINHE_RANDOM = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_SKILLS.applyTo(npc, rate);
			BASIC_SKILLS.applyTo(npc, rate);
			YINHE_SKILLS.applyTo(npc, rate);

			switch(Gmud.rand.nextInt(2)) { //技能
				case 0: //拳脚
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_QUANJIAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_QUANJIAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 1: //DAOFA
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_DAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_DAO_2.applyTo(npc, rate);
							break;
					}
					break;
			}
		}
	};

	NpcModifier SKILLANDWEAPON_SHAOLIN_RANDOM = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_SKILLS.applyTo(npc, rate);
			BASIC_SKILLS.applyTo(npc, rate);
			SHAOLIN_SKILLS.applyTo(npc, rate);

			switch(Gmud.rand.nextInt(2)) { //技能
				case 0: //拳脚
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_QUANJIAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_QUANJIAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 1: //GUN
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_GUN_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_GUN_2.applyTo(npc, rate);
							break;
					}
					break;
			}
		}
	};

	NpcModifier SKILLANDWEAPON_GAIBANG_RANDOM = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_SKILLS.applyTo(npc, rate);
			BASIC_SKILLS.applyTo(npc, rate);
			GAIBANG_SKILLS.applyTo(npc, rate);

			switch(Gmud.rand.nextInt(2)) { //技能
				case 0: //拳脚

					switch(Gmud.rand.nextInt(2)) {
						case 0:
							npc.use(Gmud.findSkill("乞者快拳").id);
							break;
						case 1:
							npc.use(Gmud.findSkill("降龙十八掌").id);
							break;
					}

					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_QUANJIAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_QUANJIAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 1: //GUN
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_GUN_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_GUN_2.applyTo(npc, rate);
							break;
					}
					break;
			}
		}
	};

	NpcModifier SKILLANDWEAPON_HUAJIAN_RANDOM = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_SKILLS.applyTo(npc, rate);
			BASIC_SKILLS.applyTo(npc, rate);
			HUAJIAN_SKILLS.applyTo(npc, rate);

			switch(Gmud.rand.nextInt(2)) { //技能
				case 0: //拳脚
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_QUANJIAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_QUANJIAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 1: //DAOFA
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_DAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_DAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 2: //BIAN
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_BIAN_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_BIAN_2.applyTo(npc, rate);
							break;
					}
					break;
			}
		}
	};

	NpcModifier SKILLANDWEAPON_XUESHAN_RANDOM = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_SKILLS.applyTo(npc, rate);
			BASIC_SKILLS.applyTo(npc, rate);
			XUESHAN_SKILLS.applyTo(npc, rate);

			switch(Gmud.rand.nextInt(2)) { //技能
				case 0: //拳脚
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_QUANJIAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_QUANJIAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 1: //剑法

					switch(Gmud.rand.nextInt(2)) {
						case 0:
							npc.use(Gmud.findSkill("入门十三式").id);
							break;
						case 1:
							npc.use(Gmud.findSkill("雪山剑法").id);
							break;
					}

					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_JIAN_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_JIAN_2.applyTo(npc, rate);
							break;
					}
					break;
			}
		}
	};

	NpcModifier SKILLANDWEAPON_TAIJI_RANDOM = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_SKILLS.applyTo(npc, rate);
			BASIC_SKILLS.applyTo(npc, rate);
			TAIJI_SKILLS.applyTo(npc, rate);

			switch(Gmud.rand.nextInt(2)) { //技能
				case 0: //拳脚
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_QUANJIAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_QUANJIAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 1: //剑法
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_JIAN_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_JIAN_2.applyTo(npc, rate);
							break;
					}
					break;
				case 2: // DAOFA
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_DAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_DAO_2.applyTo(npc, rate);
							break;
					}
					break;
			}
		}
	};

	NpcModifier SKILLANDWEAPON_BAGUA_RANDOM = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_SKILLS.applyTo(npc, rate);

			BASIC_SKILLS.applyTo(npc, rate);
			BAGUA_SKILLS.applyTo(npc, rate);

			switch(Gmud.rand.nextInt(2)) { //技能
				case 0: //拳脚

					switch(Gmud.rand.nextInt(2)) {
						case 0:
							npc.use(Gmud.findSkill("八卦游身掌").id);
							break;
						case 1:
							npc.use(Gmud.findSkill("八阵八卦掌").id);
							break;
					}

					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_QUANJIAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_QUANJIAO_2.applyTo(npc, rate);
							break;
					}
					break;
				case 1: //DAO
					switch(Gmud.rand.nextInt(2)) { //武器
						case 0:
							WEAPON_DAO_1.applyTo(npc, rate);
							break;
						case 1:
							WEAPON_DAO_2.applyTo(npc, rate);
							break;
					}
					break;
			}
		}
	};


	NpcModifier TEMPLATE_BADMAN = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_ITEMS.applyTo(npc, rate);
			CLEAR_SKILLS.applyTo(npc, rate);

			EQUIPMENTS_1.applyTo(npc, rate);
			BASIC_SKILLS.applyTo(npc, rate);
			switch(npc.faction) {
				case GameConstants.FACTION_JIANGHUXIAOXIA:
				case GameConstants.FACTION_BAGUA:
					BAGUA_SKILLS.applyTo(npc, rate);
					WEAPON_DAO_1.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_TAIJI:
					TAIJI_SKILLS.applyTo(npc, rate);
					WEAPON_JIAN_1.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_XIAOYAO:
				case GameConstants.FACTION_GAIBANG:
					GAIBANG_SKILLS.applyTo(npc, rate);
					WEAPON_GUN_1.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_HUAJIAN:
					HUAJIAN_SKILLS.applyTo(npc, rate);
					WEAPON_BIAN_1.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_HONGLIAN:
					HONGLIAN_SKILLS.applyTo(npc, rate);
					WEAPON_ZHANG_1.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_SHAOLIN:
					SHAOLIN_SKILLS.applyTo(npc, rate);
					WEAPON_GUN_1.applyTo(npc,rate);
					break;
				case GameConstants.FACTION_XUESHAN:
					XUESHAN_SKILLS.applyTo(npc, rate);
					WEAPON_JIAN_1.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_YINHE:
					YINHE_SKILLS.applyTo(npc, rate);
					WEAPON_DAO_1.applyTo(npc,rate);
					break;
			}


			npc.exp(Gmud.mc.exp);
			npc.fp(npc.getMaxfpLimit());
			npc.add(npc.getAdsLimit());
		}
	};

	NpcModifier TEMPLATE_NICEGUY = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			CLEAR_ITEMS.applyTo(npc, rate);
			CLEAR_SKILLS.applyTo(npc, rate);

			BASIC_SKILLS.applyTo(npc, rate);
			EQUIPMENTS_2.applyTo(npc, rate);

			switch(npc.faction) {
				case GameConstants.FACTION_JIANGHUXIAOXIA:
				case GameConstants.FACTION_BAGUA:
					BAGUA_SKILLS.applyTo(npc, rate);
					WEAPON_DAO_2.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_TAIJI:
					TAIJI_SKILLS.applyTo(npc, rate);
					WEAPON_JIAN_2.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_XIAOYAO:
				case GameConstants.FACTION_GAIBANG:
					GAIBANG_SKILLS.applyTo(npc, rate);
					WEAPON_GUN_2.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_HUAJIAN:
					HUAJIAN_SKILLS.applyTo(npc, rate);
					WEAPON_BIAN_2.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_HONGLIAN:
					HONGLIAN_SKILLS.applyTo(npc, rate);
					WEAPON_ZHANG_2.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_SHAOLIN:
					SHAOLIN_SKILLS.applyTo(npc, rate);
					WEAPON_GUN_2.applyTo(npc,rate);
					break;
				case GameConstants.FACTION_XUESHAN:
					XUESHAN_SKILLS.applyTo(npc, rate);
					WEAPON_JIAN_2.applyTo(npc, rate);
					break;
				case GameConstants.FACTION_YINHE:
					YINHE_SKILLS.applyTo(npc, rate);
					WEAPON_DAO_2.applyTo(npc,rate);
					break;
			}
			npc.exp(Gmud.mc.exp);
			npc.fp(npc.getMaxfpLimit());
			npc.add(npc.getAdsLimit());
		}
	};


	NpcModifier TEMPLATE_DUCHANG_ENEMY_1 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {

			ATTR_FIGHTER.applyTo(npc, rate);
			npc.applyARandomTemplate(rate,
					SKILLANDWEAPON_BAGUA_RANDOM,
					SKILLANDWEAPON_GAIBANG_RANDOM,
					SKILLANDWEAPON_HONGLIAN_RANDOM,
					SKILLANDWEAPON_HUAJIAN_RANDOM,
					SKILLANDWEAPON_SHAOLIN_RANDOM,
					SKILLANDWEAPON_TAIJI_RANDOM,
					SKILLANDWEAPON_XUESHAN_RANDOM,
					SKILLANDWEAPON_YINHE_RANDOM);

			npc.exp(Gmud.mc.exp);
			npc.applyARandomTemplate(rate, EQUIPMENTS_1, EQUIPMENTS_2);
			npc.fp(npc.getMaxfpLimit());
			npc.add(npc.getAdsLimit());
		}
	};

	NpcModifier TEMPLATE_DUCHANG_ENEMY_2 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			ATTR_ASSASSIN.applyTo(npc, rate);
			npc.applyARandomTemplate(rate,
					SKILLANDWEAPON_BAGUA_RANDOM,
					SKILLANDWEAPON_GAIBANG_RANDOM,
					SKILLANDWEAPON_HONGLIAN_RANDOM,
					SKILLANDWEAPON_HUAJIAN_RANDOM,
					SKILLANDWEAPON_SHAOLIN_RANDOM,
					SKILLANDWEAPON_TAIJI_RANDOM,
					SKILLANDWEAPON_XUESHAN_RANDOM,
					SKILLANDWEAPON_YINHE_RANDOM);

			npc.exp(Gmud.mc.exp);
			npc.applyARandomTemplate(rate, EQUIPMENTS_1, EQUIPMENTS_2);
			npc.fp(npc.getMaxfpLimit());
			npc.add(npc.getAdsLimit());
		}
	};
	NpcModifier TEMPLATE_DUCHANG_ENEMY_3 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			ATTR_MT.applyTo(npc, rate);
			npc.applyARandomTemplate(rate,
					SKILLANDWEAPON_BAGUA_RANDOM,
					SKILLANDWEAPON_GAIBANG_RANDOM,
					SKILLANDWEAPON_HONGLIAN_RANDOM,
					SKILLANDWEAPON_HUAJIAN_RANDOM,
					SKILLANDWEAPON_SHAOLIN_RANDOM,
					SKILLANDWEAPON_TAIJI_RANDOM,
					SKILLANDWEAPON_XUESHAN_RANDOM,
					SKILLANDWEAPON_YINHE_RANDOM);

			npc.exp(Gmud.mc.exp);
			npc.applyARandomTemplate(rate, EQUIPMENTS_1, EQUIPMENTS_2);
			npc.fp(npc.getMaxfpLimit());
			npc.add(npc.getAdsLimit());
		}
	};
	NpcModifier TEMPLATE_DUCHANG_ENEMY_4 = new NpcModifier() {
		@Override
		public void applyTo(Npc npc, float rate) {
			ATTR_BASHER.applyTo(npc, rate);
			npc.applyARandomTemplate(rate,
					SKILLANDWEAPON_BAGUA_RANDOM,
					SKILLANDWEAPON_GAIBANG_RANDOM,
					SKILLANDWEAPON_HONGLIAN_RANDOM,
					SKILLANDWEAPON_HUAJIAN_RANDOM,
					SKILLANDWEAPON_SHAOLIN_RANDOM,
					SKILLANDWEAPON_TAIJI_RANDOM,
					SKILLANDWEAPON_XUESHAN_RANDOM,
					SKILLANDWEAPON_YINHE_RANDOM);

			npc.exp(Gmud.mc.exp);
			npc.applyARandomTemplate(rate, EQUIPMENTS_1, EQUIPMENTS_2);
			npc.fp(npc.getMaxfpLimit());
			npc.add(npc.getAdsLimit());
		}
	};
}
